using System.IO;

namespace Universe.Farm.Service.Mesages
{
    class LookupRequestMessage: IMessage
    {
        private MessageHeader _messageHeader;
        private ServicesScope _scope;

        public LookupRequestMessage()
        {
        }


        internal LookupRequestMessage(TimeStamp stamp, string computer, ServicesScope scope)
        {
            _messageHeader = new MessageHeader(computer, stamp);
            _scope = scope;
        }

        public ServicesScope Scope
        {
            get { return _scope; }
            set { _scope = value; }
        }

        internal MessageHeader MessageHeader
        {
            get { return _messageHeader; }
        }

        void IMessage.Serialize(BinaryWriter writer)
        {
            _messageHeader.Serialize(writer);
            ScopeSerializer.Write(Scope, writer);
        }

        void IMessage.Parse(BinaryReader reader)
        {
            _messageHeader = MessageHeader.Parse(reader);
            _scope = ScopeSerializer.Read(reader);
        }
    }
}
